<?php
class SimplePerson {
    function getPerson() {        
        $fp = fopen("person.txt", "r");
        $contents = fread($fp, filesize("person.txt"));
        fclose($fp);
        $data = explode("|", $contents);
        return $data;
    }
    function savePerson($name, $age, $address){
       $contents = "$name|$age|$address";
         $fp = fopen("person.txt", "w");
       if(fwrite($fp, $contents)){
           fclose($fp);
           return "Data saved";
       };
       return "Error writing data";
    }
}
